#-----------------------------------
# Name: Christian DiDominic
# Project Madlibs.py
# Period: 1
# Start Date: 9/24/2013
# Last Revision Date: 10/9/2013
# Version: 6.9.0
#----------------------------
import os

drugList = ["cocaine",
			 "weed",
			 "dope",
			 "mary jane",
			 "lsd",
			 "alcohol",
			 "heroin",
			 "acid",
			 "marijuana",
			 "pot",
			 "pcp",
			 "morphine",
			 "codeine",
			 "nicotine",
			 "methylamine",
			 "opium",
			 "hydrocodone",
			 "meth",
			 "methamphetamine",
			 "spice",
			 "bathsalts",
			 "hgh",
			 "human growth hormones",
			 "mushrooms",
			 "shrooms",
			 "psilocybin mushrooms",
			 "ped",
			 "peds",
			 "performance enhancing drugs",
			 "salvia",
			 "tobacco",
			 "barbiturates",
			 "benzodiazepine",
			 "hydromorphone",
			 "anabolic steroids",
			 "khat",
			 "methadone",
			 "anabolic steroids",
			 "cannabis",
			 "alkyl nitrate",
			 "ecstasy",
			 "coke",
			 "heroine",
			 "morphine",
			 "vicodin",
			 "oxy",
			 "oxycodone",
			 "pizza",
			 "wholepizza",
			 "slice",
			 "g",
			 "ketamine",
			 "specialk",
			 "dope",
			 "rock",
			 "ghb",
			 "snow",
			 "methylenedioxymethamphetamine",
			 "mdma",
			 "gammajydroxybutyrate",
			 "roofies",
			 "rohypnol",
			 "hash",
			 "hashish",
			 "potatoes",
			 "keef",
			 "kush",
			 "goodkush",
			 "bath salts",
			 "ice",
			 "crank",
			 "crack",
			 "crack cocaine",
			 "crack-cocaine",
			 "smack",
			 "speed",
			 "x",
			 "vicodine",
			 "angeldust",
			 "morphine",
			 "mescaline",
			 "penicillin",
			 "tetrahydrocannabinol",
			 "thc",
			 "ak47",
			 "sourdiesel",
			 "northernlights",
			 "purplekush",
			 "skunk",
			 "whitewidow",
			 "sativa",
			 "indica",
			 "sodiumhydroxide",
			 "anhydrousammonia",
			 "iodine",
			 "redphosphorus",
			 "pseudoephedrine",
			 "ether",
			 "drano",
			 "brakefluid",
			 "lighterfluid",
			 "hydrochloricacid"
			 
			 
			 
			 
			 
			 
			 
]			  
	
swearList = ["Shane",
			 "stupid",
			 "gay",
			 "faggot",
			 "fuck",
			 "motherfucker",
			 "fucker",
			 "cunt",
			 "pussy",
			 "ass",
			 "nigger",
			 "nigga",
			 "pussyassnigga",
			 "maniggas",
			 "nig",
			 "blackpeople",
			 "niggerville",
			 "negros",
			 "niggerlover",
			 "bitch",
			 "penis",
			 "dick",
			 "cock",
			 "bitchassnigga",
			 "fag",
			 "shit",
			 "tit",
			 "tits",
			 "titties",
			 "vagina",
			 "asshole",
			 "retard",
			 "anal",
			 "analanal",
			 "analanalanal",
			 "piss",
			 "slut",
			 "whore",
			 "hoes",
			 "whores",
			 "sluts",
			 "screwoff",
			 "jackoff",
			 "jerkoff",
			 "fingeronesself",
			 "fetish",
			 "bigblackcock",
			 "smallwhitedick",
			 "porn",
			 "pornography",
			 "pornhub.com",
			 "bigass",
			 "bigtits",
			 "threesome",
			 "facial",
			 "cum",
			 "taint",
			 "cumshot",
			 "commerford",
			 "semen",
			 "jizz",
			 "wetandtight",
			 "blowjob",
			 "handjob",
			 "footjob",
			 "earjob",
			 "kneejob",
			 "ejaculate",
			 "boobjob",
			 "tittyfuck",
			 "douche",
			 "douchebag",
			 "bitchface",
			 "shitstain",
			 "fuckface",
			 "fagface",
			 "dildoface",
			 "dildocream",
			 "dildojuice",
			 "flaciddildos",
			 "dildomatic",
			 "juicydildos",
			 "dildo",
			 "dildos",
			 "bignblackdildos",
			 "purpledildos",
			 "greendildos",
			 "ilikegreen",
			 "dildosquared",
			 "squarerootofdildo",
			 "tangantdildo",
			 "cosinedildo",
			 "cotangantdildo",
			 "secantdildo",
			 "cosecantdildo",
			 "sinedildo",
			 "logbasedildo",
			 "cumsumdildo",
			 "zscoredildo",
			 "tscoredildo",
			 "chisquareddildo",
			 
		   
			 
			
]
			 
bgColor = '0'
txtColor = 'F'

def getMenuOption(maxOptions):
	option = ""
	goodOption = False
	while not goodOption:
		option = raw_input("Enter a number or S or Q> ")
		option = option.upper()
		if option == 'S':
			goodOption = True
		elif option == 'E':
			goodOption = True
		elif option == 'Q' :
			goodOption = True
		elif option == "":
			pass
		else:
			isNum = True
			for character in option:
				if character not in "0123456789":
					isNum = False
			if isNum:
				if int(option) <= 0:
					isNum = False
				elif int(option) > maxOptions:
					isNum = False
			if isNum:
				goodOption = True
			else:
				print "Please type a number!"
		if not goodOption:
			print "Invalid Choice, please try again. "
	return option

def menu():
	print "Welcome to Madlibs"
	print "Please Select an Option:"
	print " [1] The Adventures of Shane"
	print " [2] The Day Carter Became Cool Again"
	print " [3] The Run"
	print " [S] Settings"
	print " [E] IN CASE OF EMERGENCY ONLY"
	print " [Q] Rage Quit"
	option = getMenuOption(3)
	return option

def getWord(prompt):
	word = ""
	goodWord = False
	while not goodWord:
		word = raw_input(prompt)
		if word.lower() not in swearList:
			goodWord = True
		else:
			print "Naughty user... please be polite."
		if word == "":
			goodWord = False
			print "Stop being gay and enter a response."
			
		if word.isdigit() or word[1:].isdigit():
			goodWord = False
			print "That is not a word, dumbass."
		if not goodWord:
			print "Please try again."
	   
	return word
	
def getBadWord(prompt):
	word = ""
	BadWord = False
	while not BadWord:
		word = raw_input(prompt)
		if word.lower() in swearList:
			BadWord = True
		if word not in swearList:
			BadWord = True
		if word == "":
			BadWord = False
			print "Stop being gay and enter a response."
		if word.isdigit() or word[1:].isdigit():
			BadWord = False
			print "That is not a word, dumbass."
		if not BadWord:
			print "Please try again."
	return word

def getDrug(prompt):
	word = ""
	BadWord = False
	while not BadWord:
		word = raw_input(prompt)
		if word.lower() in drugList:
			BadWord = True
		else:
			print "Enter some-sort of illegal substance that will get you messed-up."
		if not BadWord:
			print "Please try again."
	return word	 
	
def getNumber(prompt, min = "", max = ""):
		num = ""
		goodNumber = False
		while not goodNumber:
			num = raw_input(prompt)
			isNum = True
			for digit in num:
				if digit not in ".0123456789":
					isNum = False
			if isNum:
				if min != "":
					if float(num) < min:
						isNum = False
				if max != "":
					if float(num) > max:
						isNum = False
			if num == "":
				isNum = False
				print "Stop being gay and enter a response."
			if isNum:
				goodNumber = True
			else:
				print "Please enter a valid number"
		return num
		
def getWholeNumber(prompt, min = "", max = ""):
		num = ""
		goodNumber = False
		while not goodNumber:
			num = raw_input(prompt)
			isNum = True
			for digit in num:
				if digit not in "0123456789":
					isNum = False
			if isNum:
				if min != "":
					if float(num) < min:
						isNum = False
				if max != "":
					if float(num) > max:
						isNum = False
			if num == "":
					isNum = False
					print "Stop being gay and enter a response."
			if isNum:
				goodNumber = True
			else:
				print "Please enter a whole number"
		return num
					 
def getColor(prompt):
	colors = ["black",
			  "blue",
			  "green",
			  "bright white",
			  "light red",
			  "red"]
	opt = ""
	goodColor = False
	while not goodColor:
		opt = raw_input(prompt)
		if opt.lower() in colors:
			goodColor = True
	if opt == "black":
		color = '0'
	elif opt == 'blue':
		color = '1'
	elif opt == 'green':
		color = '2'
	elif opt == 'bright white':
		color = 'F'
	elif opt == 'light red':
		color = 'C'
	elif opt == 'red':
		color = '4'
	return color
		
			
					
def story1():
	badword1 = getBadWord("Enter a swear word: ")
	verb1 = getWord("Enter a verb: ")
	adj1 = getWord("Enter an adjective: ")
	place1 = getWord("Enter a place (proper noun): ")
	object1 = getWord("Enter an object (singular): ")
	drug1 = getDrug("Enter a substance: ")
	hal1 = getWord("Enter a mystical creature (plural): ")
	place2 = getWord("Enter a place: ")
	gerund1 = getWord("Enter a gerund: ")
	number1 = getWholeNumber("Enter a whole number: ")
	prof1 = getWord("Enter a profession (plural): ")
	verb2 = getWord("Enter a verb: ")
	med1 = getWord("Enter a medicine: ")
	number2 = getWholeNumber("Enter a whole number: ")
	
	story = "There once was a boy named Shane, he was a little "
	story += badword1 + ". "
	story += "Shane always liked to "
	story += verb1 + ", "
	story += "he was really "
	story += adj1 + " at it. "
	story += "One day, Shane decided to " + verb1
	story += " all the way to " + place1
	story += ". "
	story += "Once Shane arrived, he leaned up against a " + object1 
	story += " and lit up some " + drug1
	story += ". After some time, Shane started seeing some crazy " + hal1
	story += ". Shane began " +gerund1
	story += " with the " +hal1
	story += ". "
	story += "After some time, Shane passed out and woke up in a " + place2
	story += " surrounded by " + number1 + " "
	story += prof1 + ". The "
	story += prof1 + " began to "
	story += verb2 + " Shane, because Shane told the "
	story += prof1 + " that he was one of the "
	story += hal1 + ". The "
	story += prof1 + " decided to inject Shane with "
	story += med1 + " to counter the effects of the "
	story += drug1 + ". "
	story += "After " + number2
	story += " hours, Shane was sober again and was on his way." 
	
	
	
	
	print story

def story2():
	gerund1 = getWord("Enter a gerund: ")
	noun1 = getWord("Enter an object: ")
	verb1 = getWord("Enter a verb: ")
	number1 = getNumber("Enter a number: ")
	noun2 = getWord("Enter a noun (plural): ")
	class1 = getWord("Enter a course in school: ")
	number2 = getNumber("Enter a number: ")
	name1 = getWord("Enter the name of a friend: ")
	
	story = "One day, Carter thought to himself, 'Hey, I'm going to be cool again.' "
	story += "So, instead of Carter doing his usual " + noun1
	story += " " + gerund1
	story += ", Carter started to " + verb1
	story += ". After that, Carter became " + number1
	story += "x cooler. He began getting all of the "
	story += noun2 + ". "
	story += "But after some time, Carter realized that by being cool his grade in " + class1
	story += " dropped to an A-. "
	story += "He then went back to studying for " + number2
	story += " hours per day. Eventually, all of his " + noun2
	story += " left him for " + name1
	story += ". " "Because " + name1
	story += " was able to " + verb1
	story += " for the " + noun2
	story += " way better than Carter once did. "
	
	
	
	
	print story
	
def story3():
	name1 = getWord("Enter a name: ")
	drug1 = getDrug("Enter an illegal substance: ")
	name2 = getWord("Enter a name: ")
	place1 = getWord("Enter the name of a place (non-proper): ")
	verb1 = getWord("Enter an action (past-tense): ")
	color1 = getWord("Enter a color: ")
	object1 = getWord("Enter an object (plural): ")
	weapon1 = getWord("Enter a weapon: ")
	action1 = getWord("Enter an action (gerund): ")
	hlg1 = getWord("Enter the name of a place/spot (non-plural): ")
	time1 = getWord("Enter a number: ")
	animal1 = getWord("Enter an animal (plural): ")
	vehicle1 = getWord("Enter a transportation device: ")
	
	story = "One day " + name1
	story += " was doing some " + drug1
	story += " when a patrol car pulled up, it was Officer " + name2
	story += ". " + name1
	story += " turned around and " + verb1
	story += " into the " + place1
	story += ". Officer " + name2
	story += " threw on his " + color1
	story += " lights and then " + verb1
	story += " after " + name1 + " into the " + place1 + ". "
	story += "Officer " + name2 + " started to catch up to " + name1
	story += ", so " + name1 + " began to throw " + object1
	story += " at the cop.	Officer " + name2 + " pulled out his " + weapon1
	story += " and started " + action1 + " at " + name1 + ". "
	story += "But " + name1 + " was able to get away from the cop and hide in a " + hlg1 + " as Officer " + name2 + " " + verb1 + " right by him. "
	story += "After hiding out for " + time1 + " hours, " + name1 + " heard the sound of " + animal1 + " running through the " + place1 + ", approaching "
	story += name1 + " quickly. " + name1 + " came out of the " + hlg1 + " and " + verb1 + " as hard as he could away from the " + animal1
	story += ". " + name1 + " made it the other side of the school, where he met up with his getaway " + vehicle1 + " and got away."
	
	
	
	print story
	
def emerg(size=1):
	count = 1
	while count >= size:
		print "dildo"
		count += 1
		
	 

def settings():
	txtColor = getColor("Enter Text Color: ")
	bgColor = getColor("Enter Backgound Color: ")
	if txtColor != bgColor:
		os.system("color " + bgColor + txtColor)
	
def run():
	choice = ""
	while choice != 'Q':
		choice = menu()
		if choice == '1':
			story1()
		elif choice == '2':
			story2()
		elif choice == '3':
			story3()
		elif choice == 'S':
			settings()
		elif choice == 'E': 
			emerg()
		elif choice == 'Q':
			print "Rage Quit!!! YoU mAd BRO??"
			os.system("color " + bgColor + txtColor)
			raw_input("Press enter to exit")
		else:
			print "Something terrible has happened...go yell at the programmer"
	
run()
		
		
		
		
		
		
  